<nav aria-label="...">
    <ul class="pagination justify-content-end">
        <!-- 上一页 -->
        {% if page_obj.has_previous %}
        <li class="page-item">
            <a class="page-link" href="?page={{page_obj.previous_page_number}}&search={{search_text}}">上一页</a>
        </li>
        {% else %}
        <li class="page-item disabled">
            <a class="page-link">上一页</a>
        </li>
        {% endif %}

        <!-- 中间页面展示区 -->
        {% for num in page_obj.paginator.page_range %}
        {% if num >= page_obj.number|add:-5 and num <= page_obj.number|add:5 %} 
            {% if num == page_obj.number %} 
            <li class="page-item active"><a class="page-link" href="?page={{num}}&search={{search_text}}">{{ num }}</a></li>
            {% else %}
            <li class="page-item"><a class="page-link" href="?page={{num}}&search={{search_text}}">{{ num }}</a></li>
            {% endif %}
        {% endif %}
        {% endfor %}

        <!-- 下一页 -->
        {% if page_obj.has_next %}
        <li class="page-item">
            <a class="page-link" href="?page={{page_obj.next_page_number}}&search={{search_text}}">下一页</a>
        </li>
        {% else %}
        <li class="page-item disabled">
            <a class="page-link">下一页</a>
        </li>
        {% endif %}
    </ul>
</nav>